﻿
var ReportTitle = '<table cellpadding="0" cellspacing="0" border="0" width="3500px">' +
'<tr>' +
    '<td rowspan="3" class="title">设备编码</td>' +
    '<td rowspan="3" class="title1">设备名称</td>' +
    '<td rowspan="3" class="title1">规格型号</td>' +
    '<td rowspan="3" class="title1">租用状态</td>' +
    '<td rowspan="3" class="title1">租用标志</td>' +
    '<td rowspan="3" class="title1">日租金</td>' +
    '<td rowspan="3" class="title1">单位</td>' +
    '<td rowspan="3" class="title1">生产厂家</td>' +
    '<td rowspan="3" class="title1">供应商</td>' +
    '<td rowspan="3" class="title1">技术参数</td>' +
    '<td rowspan="3" class="title1">数量</td>' +
    '<td rowspan="3" class="title1">设备原值</td>' +
    '<td rowspan="3" class="title1">生产日期</td>' +
    '<td rowspan="3" class="title1">出厂日期</td>' +
    '<td rowspan="3" class="title1">登记日期</td>' +
    '<td rowspan="3" class="title1">使用年限</td>' +
    '<td colspan="2" class="splittitle">设备来源</td>' +
    '<td colspan="11" class="zxdttitle">最新动态</td>' +
    '<td colspan="2"  class="splittitle">本月入</td>' +
    '<td colspan="5" class="splittitleFfive">计划</td>' +
    '<td colspan="4" class="splittitlefour">合同</td>' +
    '<td rowspan="3" class="title1">设备分类</td>' +
    '<td rowspan="3" class="title1">设备完好情况</td>' +
    '<td rowspan="3" class="title1">维检周期(天)</td>' +
    '<td rowspan="3" class="title1">上次维检时间</td>' +
    '<td rowspan="3" class="title1">上次给检计划编号</td>' +
'</tr>' +
'<tr>' +
    '<td rowspan="2" class="splittitle1">编码</td>' +
    '<td rowspan="2" class="splittitle1">名称</td>' +
    '<td colspan="2" class="zxdttitle1">存放位置</td>' +
    '<td colspan="2" class="zxdttitle1">使用地点</td>' +
    '<td colspan="2" class="zxdttitle1">维修使用</td>' +
    '<td colspan="2" class="zxdttitle1">设备状态</td>' +
    '<td colspan="2" class="zxdttitle1">单据类型</td>' +
    '<td rowspan="2" class="zxdttitle3">备注</td>' +
    '<td rowspan="2" class="splittitle1">入库数量</td>' +
    '<td rowspan="2" class="splittitle1">出库数量</td>' +
    '<td rowspan="2" class="splittitle1">上报单位</td>' +
    '<td rowspan="2" class="splittitle1">上报日期</td>' +
    '<td rowspan="2" class="splittitle1">计划编号</td>' +
    '<td rowspan="2" class="splittitle1">计划审批</td>' +
    '<td rowspan="2" class="splittitle1">单位编码</td>' +
    '<td rowspan="2" class="splittitle1">签定单位</td>' +
    '<td rowspan="2" class="splittitle1">签定时间</td>' +
    '<td rowspan="2" class="splittitle1">合同编号</td>' +
    '<td rowspan="2" class="splittitle1">合同审批</td>' +
'</tr>' +
'<tr>' +
    '<td class="zxdttitle2">编码</td>' +
    '<td class="zxdttitle2">名称</td>' +
    '<td class="zxdttitle2">编码</td>' +
    '<td class="zxdttitle2">名称</td>' +
    '<td class="zxdttitle2">开始日期</td>' +
    '<td class="zxdttitle2">天数</td>' +
    '<td class="zxdttitle2">编码</td>' +
    '<td class="zxdttitle2">名称</td>' +
    '<td class="zxdttitle2">编码</td>' +
    '<td class="zxdttitle2">名称</td>' +
'</tr>';

var ReportBottom = "</table>";
var RedFont = function (k) {
    if (k < 0) {
        return '<font color="red">' + k + '</font>'
    }
    return k;
}
var StateName = function (k) {
    if (k == "0") {
        return '<font color="#000000">未租用</font>';
    }
    if (k == "1") {
        return '<font color="red">租用中</font>';
    }
    return k;
}
var dwidth = 0;
var dheight = 0;
var BindData = function (data) {
    var h = ReportTitle;
    if (data != null) {
        for (var i = 0; i < data.length; i++) {
            h += '<tr ondblclick="RowClick(this);">' +
            '<td class="data">&nbsp;' + data[i].设备编码 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].设备名称 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].规格型号 + '</td>' +
            '<td class="data1">&nbsp;' + StateName(data[i].租用状态) + '</td>' +
            '<td class="data1">&nbsp;' + data[i].租用标记 + '</td>' +
            '<td class="data1">&nbsp;' + RedFont(data[i].日租金) + '</td>' +
            '<td class="data1">&nbsp;' + data[i].单位 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].生产厂家 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].供应商 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].技术参数 + '</td>' +
            '<td class="data1">&nbsp;' + RedFont(data[i].数量)+ '</td>' +
            '<td class="data1">&nbsp;' + RedFont(data[i].设备原值) + '</td>' +
            '<td class="data1">&nbsp;' + data[i].生产日期 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].出厂日期 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].登记日期 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].使用年限 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].设备来源编码 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].设备来源名称 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].存放位置编码 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].存放位置名称 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].使用地点编码 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].使用地点名称 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].维修开始日期 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].维修天数 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].设备状态编码 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].设备状态名称 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].单据类型编码 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].单据类型名称 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].最新动态备注 + '</td>' +
            '<td class="data1">&nbsp;' + RedFont(data[i].本月入库) + '</td>' +
            '<td class="data1">&nbsp;' + RedFont(data[i].本月出库) + '</td>' +
            '<td class="data1">&nbsp;' + data[i].计划上报单位 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].计划上报日期 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].计划编号 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].计划审批 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].计划单位编码 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].合同签定单位 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].合同签定时间 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].合同编号 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].合同审批 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].设备分类 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].设备完好情况 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].设备维检周期 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].上次维检时间 + '</td>' +
            '<td class="data1">&nbsp;' + data[i].上次给检计划编号 + '</td>' +
        '</tr>';
        }
        h += ReportBottom;
    }
    dwidth = Ext.getBody().getWidth();
    dheight = Ext.getBody().getHeight()-60;
    return '<div style="overflow:scroll;width:' + dwidth + 'px;height:' + dheight + 'px">' + h + '</div>';
}

var RowClick = function (e) {
    window.open("index.aspx");
}
